/**
 * Created by dale on 2017/8/24.
 */
var keyId;
var  planList;
var iDepId;
$(document).ready(function () {
    planList= $('#planList');
    $('.xh-datagrid-toolbar').parseToolbar();

    //设置禁用

    planList.treegrid({
        onSelect:function (row) {
            keyId=row['keyId'];
            planList.treegrid('expand',keyId);

        },
        onBeforeSelect:function (row) {
            if(keyId==undefined){
                return true;
            }else {
                if(keyId==row['keyId']){
                    planList.treegrid('unselect',keyId);
                    planList.treegrid('collapse',keyId);
                    keyId=null;
                    return false;
                }
            }
        },
        onBeforeCheck:function (row) {
            if(keyId==undefined){
                return true;
            }else {
                if(keyId==row['keyId']){
                    planList.treegrid('uncheckRow',keyId);
                    keyId=null;
                    return false;
                }
            }
        }

    });

    

});